Gamma ray spectroscopy with quantitative analysis

ABSTRACT

An illustrative embodiment of the invention includes methods and apparatus for obtaining gamma ray spectra of earth formations surrounding an open or cased well borehole. Pulsed neutrons of 14 MEV are used to excite the elements around the well bore and a scintillation detector is activated a predetermined time after each pulse from the source to detect gamma rays resulting from the capture in the earth formation of thermalized neutrons from the source. The spectrum of gamma rays so resulting is obtained and compared with a composite spectrum made up of a weighted mixture of standard spectra by the use of the least squares technique. The gain and threshold values of the standard spectra are adjusted and the composite spectra resulting therefrom are again compared with the unknown spectrum and this process repeated until the best possible fit of the standard composite spectrum is obtained. The weights of the standards so obtained are then logged as a function of borehole depth to provide lithology information.

atent 1 States Elite Scott GAMMA RAY SPECTROSCOPY WITH QUANTITATIVEANALYSIS [75] Inventor: Hubert D. Scott, Houston, Tex.

[73] Assignee: Texaco Inc., New York, NY.

[22] Filed: July 19, 1971 [21] Appl. No.: 163,982

[52] US. Cl. 250/833 R, 250/83.6 W

[51] Int. Cl. G01t 1/16 [58] Field of Search 250/715 R, 83.3 R,

[56] References Cited UNITED STATES PATENTS 3,521,064 7/l970 Moran etal. 250/816 W Primary Examiner-James W. Lawrence Assistant Examiner-D.L. Willis Attorney-Thomas H. Whaley and Carl G. Reis ABSTRACT Anillustrative embodiment of the invention includes methods and apparatusfor obtaining gamma ray spectra of earth formations surrounding an openor cased well borehole. Pulsed neutrons of 14 MEV are used to excite theelements around the well bore and a scintillation detector is activateda predetermined time after each pulse from the source to detect gammarays resulting from the capture in the earth formation of thermalizedneutrons from the source. The spectrum of gamma rays so resulting isobtained and compared with a composite spectrum made up of a weightedmixture of standard spectra by the use of the least squares tech nique.The gain and threshold values of the standard spectra are adjusted andthe composite spectra resulting therefrom are again compared with theunknown spectrum and this process repeated until the best possible fitof the standard composite spectrum is obtained. The weights of thestandards so obtained are then logged as a function of borehole depth toprovide lithology information.

20 Claims, 5 Drawing Figures JLs) . I I I I 264;; V r a Z5 sum MPE;SPEC7RA DE SOURCE PAi'ENTEU 3,739,171

W 1 M a ECORDER f FIG! 23 42 V I PULSE jcoMRARlsolv HEGHT ,7 1 Li:COMPUTER ANALYZER 25% 1 48 P 2?" STANDARD TAPE sPEcTRA RECORDER SOURCE@WAWKV Av E /ZKV/K Y/KW /Z V/Z M/DPOINT ENERGY SFEETQUFQ COUNTS PERCHANNEL SILICON CALC/UM\\\ U 1 I I 2 3 4 5 6 7 8 GAMMA RAY ENERGY (MEV)\J Lu 5 I I i (S I E, I i

?s .5 CHANNEL NUMBER FIG- 3 PMENTEDJUM 2x913 i or 4 USE ORIGINAL CALLPROGRAM FIG. 5 TO g m ML/ERAMRVA I55)? I a; iI gc rI L f iiRy NEXT 4 UPM U 5 .UQQ F EQ A LIBRARY FOR 82/ INPUT UNKNOWN NEXT FIT I SPECTRUM IN/T 0 NSRCH =0 l I SET INITIAL GAIN I 84 AND BASELINE SHIFT r LLLWLWW Y1 REF/ ORE? WE GIITED M f 85 I LEAST SQUARES E/T CORRECT I GAIN ANO /a5BASELINE I 50 l RE EST/MA TE /a7 GAIN BASELINE 1* I I GAIN AND I iBASELINE NO AGREE WITH LIBRARY VALUES I 92 I OUTPUT /5 YES WEIGHTS OF INSRCH=3 UNKNOWN N SPECTRUM AND RESIDUALS I I I SPECTRA IMPROVE FIT NSRCH7 NSRCH PAINTED- SHEET '4 [If 4 FIG. 5

SELECT STANDARD SPECTRUM TO ESMBLISH TEMP LIBRARY STAND CHANGE GAIN 6 BY[PERFORM LEAST SQUARES FIT CHANGE G BY +I% CHANGE G BY I% PERFORM LEASTSQUARES PERFORM LEAST SQUARES I FIT FIT IM- PROVED CHANGE B BY 7 CHANNELFIT PERFORM LEAST SQUARES PERFORM LEA ST SQUARES IS F/T IM- YES PROVE DFIT I17 MAINTAIN IS PREVIOUS B FIT IM- NO SETTING NO RO L E D PLACEMODIFIED STANDARD IN TEMP LIBRARY GO ON 70 NEXT 5 TA NDA RD GAMMA RAYSPECTROSCOPY WITH QUANTITATIVE ANALYSIS This invention relates tomethods and apparatus for investigating the characteristics ofsubsurface earth formations and more particularly relates to improvedradioactivity well logging methods and apparatus for determining thelithology of earth formations surrounding a well borehole.

It is well known that earth formations surrounding a well borehole emitnatural gamma radiation. It is also well known that nuclei of earthmaterials surrounding a well borehole may be excited by the capture ofneutrons emitted from a well tool in the borehole. Such an excitednucleus may then return to a lower energy level state emitting gammaradiation in the process. The emitted radiation may also be detected bya well tool in the borehole.

it is also known that the gamma radiations emitted by elements whichoccur naturally in the earth formations surrounding the wellbore or bynuclei which have been excited by neutrons emitted by a well tool havingcertain characteristic energy spectra. That is to say, if the energyspectra of gamma rays emitted by elements in the materials surroundingthe wellbore could be determined accurately such spectra would beindicative of the particular combinations of elements which emitted thegamma rays. Accordingly, it has been proposed in the prior art todetermine the constituency of earth formations surrounding a wellbore byobtaining at least portions of the energy spectra of the gamma radiationemitted by the materials surrounding the wellbore both by the naturallyoccurring gamma radiation and the gamma radiation resulting from thebombardment of the materials surrounding the wellbore by neutrons.

In addition to a qualitative determination of the elements comprisingthe formation materials surrounding the borehole it is highly desirableto be able to attach a quantitative significance to the appearance ofeach of these elements, if possible. For example, certain anomalous loginterpretations can result in open hole well logging portions of thewell which appear to have porous characteristics. These portions of thewell may be contaminated by impurities which mask their true nature.Such formations as shaly sands or fresh water filled limestones aredifficult to discern compared to clean or uncontaminated oil sands. insuch formations it is difficult to interpret the response ofconventional logging tools such as electrical or sonic logs which may beused. Moreover, if the well in question is a previously completed wellit will generally be impossible to perform electrical surveys todetermine the characteristics of formations behind the cemented casing.Thus, in cased or previously completed well boreholes nuclear welllogging tools which irradiate the earth formations with penetratingneutron or gamma radiation may be the only means of determining thecharacteristics of the earth formations behind the casing. It istherefore highly desirable that gamma ray energy spectra of either openor cased boreholes and resulting either from naturally occurring gammaradiation or from induced gamma radiation be recordable and analyzablein a quantitative sense.

Gamma ray energy spectra may be obtained by passing a well logging too]have a proportional detector through the borehole and separating theoutput of the detector as a function of energy. A proportional detectorsuch as a scintillation counter is typically used for this purpose. Ascintillation counter adapted for borehole use typically will contain ascintillating material such as thallium doped sodium iodide or cesiumiodide or the like which, when exposed to gamma radiation, will emitflashes of light which are proportional in intensity to the energy ofthe exciting radiation. These light flashes within the scintillationcrystal are then coupled to a photomultiplier tube or other equivalentlight detection electronics which produces electrical pulses whoseheight generally is proportional to the intensity of the light emittedby the scintillation crystal.

The pulses representative of gamma rays having a particular energyrepresented by the pulse height are then generally processed as, forexample, by a pulse height analyzer which sorts the pulses according totheir height and accumulates in a number of storage devices, orchannels, the number of pulses of a given height which occur. Byapplying successive pulses produced by the electronic circuitry of theborehole tool to the pulse height analyzer a spectrum of the gamma rayenergy of substances in and around the borehole may be obtained. Thenumber of counts occurring in a certain channel is plotted against thechannel number (or energy level) of the analyzer channel in question. Asmany as one thousand or more such analyzer channels may be used toobtain gamma ray spectra in this manner.

Many sources of error can act on the data between the time a gamma raypasses through the scintillation crystal and the time in which therepresentative electrical pulse corresponding to this event is sortedaccording to its height. For example, the energy resolutioncharacteristics of the crystal itself may be relatively crude. That isto say, the crystal may emit a light flash of nearly the same intensityfor a relatively wide range of initial gamma ray energies. This canoccur due to the size of the crystal and the type of energy loss processof -y rays in the crystal. This constitutes a physical limitation whichis a property of the material comprising the crystal and which must betaken into account when analyzing the gamma ray spectrum resulting fromthe use of such a crystal.

Generally several thousand feet of well logging cable are interposedbetween the photomultiplier tube and the surface of the earth at whichthe multichannel pulse height analyzer instrument is located. Because ofthis the resulting pulses from the photomultiplier tube must generallybe amplified before being transmitted up this relatively long length ofelectrical cable to the surface. In borehole gamma ray spectroscopy itis of course imperative that this amplification take place in as nearlylinear a manner as possible. Therefore any power supply voltagevariations or temperature variations which effect the linearity of theamplifier used for this purpose also cause errors. These errors resultin a general uncertainty being applied to the amplitude of the pulserepresenting the light flash intensity prior to its transmission to thesurface. This, in turn, results in a general smearing of the features ofthe overall gamma ray spectrum.

Once the pulse reaches the surface it is applied to the pulse heightanalyzer. This instrument may, for example, operate by applying thepulse to an integrator circuit which builds up and stores its charge(proportional to its height) in a rapid manner. This charge can be used(if it exceeds a threhold level) to open a gating circuit which may beused, for example, to gate the output of a high frequency oscillatorinto a counter register. The time required for the pulse to decay to apredetermined level which allows the gate to close then may be measuredby examining the contents of the counter register when the gate closes.

It will be appreciated that with this type of pulse height analyzer anyerror which may occur in the high frequency oscillator frequency due toshort term variations in power supply voltage or temperature variationscan result in a general fuzzing or broadening of the energy peaks of thegamma ray spectra. Moreover, further amplification of the pulsegenerally takes place in a typical pulse height analyzer prior to itssubmission to such a pulse sorting or separating circuit. The linearityof such amplification is critical in determining the resulting shape ofthe gamma ray energy spectrum. A drift in the gain of such an amplifiercan result in an overall displacement or shift of the energy spectrum ora different energy/channel relationship as the pulses height is variedwith respect to the opening threshold of the oscillator gating circuit.

The net result of the operation of all these error sources is to producea gamma ray spectrum which has smeared out peaks. Such peak smearingcauses adjacent peaks, which may be relatively close together in theenergy spectrum, to become merged with each other. In particular thebase portion of these peaks are superimposed upon each other in such amanner that the overall shape of an individual peak may beindiscernible.

In addition to the above cited instrumentation problems degradation ofthe gamma rays themselves due to Compton scattering occurs. Similarlythe gamma ray source may be other than that assumed. For example aninelastic scattering event may occur as opposed to a thermal neutroncapture gamma ray emmission. Such events may result in the gamma rayspectrum being generally smeared out or distorted. All of these factorscoupled together lead to a general degradation of the overall quality ofthe gamma ray spectrum. Such degradation of the quality of the spectrummakes it imperative that a very careful comparison or analysis of thegamma ray spectrum be performed. Mere observations or rough estimatesbased on visual comparison or other such cut and try methods can lead tothe generation of large errors particularly in making only quantitativeestimates of the presence of an element.

In the prior art it has been known to visually compare gamma ray energyspectra of standard sources made with the same instrument with unknowngamma ray spectra made in a well borehole. This comparison has largelybeen qualitative to the present time due to the degradation of the gammaray spectrum from the error sources as previously mentioned.

Accordingly, it is an object of the present invention to provide new andimproved methods and apparatus for analyzing gamma ray spectra todetermine the composition of well formations adjacent to a wellborewhich effectively overcome the disadvantages of the prior art.

Another object of the invention is to provide new and improved methodsand apparatus for analyzing gamma ray spectra of subsurface earthformations by comparing the spectra more accurately than heretoforepossible with standard element spectra made with the same instrument.

Yet another. object of the present invention is to provide methods andapparatus for making quantitative analysis of gamma ray spectraresulting from gamma radiation emanating from earth formationssurrounding a wellbore possible in a manner more accurate thanheretofore obtainable.

These and other objects, features and advantages of the presentinvention are accomplished by obtaining a gamma ray spectrum from theunknown materials surrounding a well borehole. In a preferred embodimentof the invention, this is performed by using neutron irradiationtechniques to excite the formations. In this preferred embodiment apulsed neutron source of high energy neutrons is utilized to excite theelements in the earth formations surrounding the well bore. Ascintillation type detector is activated a predetermined time after theconclusion of each neutron pulse so as to allow gamma rays resultingfrom nuclear excitation of the material in the borehole proper to dieaway. Scintillation count pulses representing gamma rays emanating fromthe earth formation surrounding the wellbore are then detected andsupplied via a well logging cable to pulse height analyzing apparatus atthe surface of the earth. The gamma ray spectrum resulting therefrom isobtained. This unknown gamma ray spectrum is then compared withpreviously determined standard gamma ray spectra combined in a weightedmanner to make up a weighted composite spectrum. The unknown weights ofeach standard component of the composite spectrum which gives the bestfit to the unknown spectrum are determined by application of the methodof least squares. A unique iterative scheme for adjusting the gain andbaseline or threshold of the standard spectra to best fit the unknownspectrum for elimination of instrumentation error is then applied toinsure a more accurate fit in this least squares technique.

Other objects, features and advantages of the invention are pointed outwith particularity in the appended claims. The present invention is bestunderstood from the following detailed description thereof when taken inconjunction with the accompanying drawings in which:

BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is an overall block diagramshowing schematically a system embodying the concepts of the invention;

FIG. 2 shows a plurality of standard gamma ray spectra which may betaken in a mix to form a composite spectrum in the manner of theinvention;

FIG. 3 is a graphical illustration of the effect of a type ofinstrumentation error which may be accounted for by applying thetechniques of the invention;

FIG. 4 is an overall logic flow diagram for a computer program forperforming the comparison of gamma ray spectra in accordance with theinvention; and

FIG. 5 is a more detailed logic flow diagram for performing a portion ofthe overall technique outlined in the diagram of FIG. 4.

DESCRIPTION OF THE PREFERRED EMBODIMENT Referring initially to FIG. 1there may be seen a simplified functional representation of theapparatus of the invention showing a borehole 2 in the earth formation 3which is lined in a conventional manner with a steel casing 4 or thelike and which further contains a portion of a well logging systemarranged and adapted to investigate preselected characteristics of thesurrounding earth formations 3. More particularly the logging system maybe seen to be basically composed of an elongated, fluid tight hollowbody member or sonde 5 which is adapted to be passed longitudinallythrough the casing 4. Instrumentation is shown which is located at thesurface for processing and recording electrical measurements provided bythe sonde 5. A logging cable 6 passing over a sheave wheel 7 is used tosupport the sonde 5 in the borehole. The cable 6 may have one or moreconductors for transmitting electrical signals between the sonde 5 andthe surface apparatus.

Again referring to FIG. 1, the sonde 5 contains a source of high energyneutrons 11. The neutron source contemplated for use herein comprises adeuteriumtritium reaction accelerator but it will be understood that theinvention is not limited thereto. The neutron source 11 may be of anysuitable design, for example, a continuous neutron source could be usedif desired, and located at a suitable position within the sonde 5. Asuitable radiation detector 8 for detecting capture gamma rays resultingfrom bombardment of the surrounding earth formations 3 is depictedschematically. This detector 8 may be a sodium iodide, cesium iodide orother crystal or the like which is optically coupled to aphotomultiplier tube 9 of suitable design. A radiation shield 10 ofsuitable composition such as a combination of lead, polystyrene, luciteplastic or other high hydrogen content material or the like ispreferably interposed between the accelerator 11 and the crystal 8 toprevent or reduce direct irradiation of the crystal as a result of theneutrons emitted from the accelerator As is well known in the art thescintillation crystal 8 produces a discrete flash of light whenever agamma ray passes through the crystal. It is a function of thephotomultiplier tube 9 to generate a voltage pulse proportional to theintensity of each such scintillation which occurs in the crystal 8. Theintensity of such scintillations is functionally related to the energyof the gamma ray and thus each voltage pulse generated by thephotomultiplier tube 9 will have an amplitude func tionally related tothe terminal energy of the corresponding gamma ray which has beendetected. Accordingly, the proportional voltage pulses which areproduced by the photomultiplier tube 9 constitute the detector signalapplied to a linear amplifier 13 via conductor 17.

The detector signal on conductor 17 may contain other pulses than thosesought to be detected. For example, photomultiplier tube 9 itself cangenerate spurious signals. These signals are usually of a relatively lowamplitude and may be discriminated against on this basis. In additionthe crystal scintillator 8 may be expected to be struck by some neutronsemanating from the accelerator 11 in spite of the shielding 10. Thesecould be, for example, neutrons which are scattered by the fluid in theborehole 2 and surrounding earth formations 3 and which thereafterreturn to the vicinity of the sonde by an indirect route to strike thecrystal 8 and interact with elements therein. The crystal 8 itself canbecome activated due to the reaction 1'" (My) 1 This reaction willproduce gamma rays associated with scintillations in response to theresulting 2.12 MEV beta particle emissions of the radioactive iodine128. Such spurious scintillations again may be discriminated against bya preset level bias. A conventional discriminator or bias level circuit14 as known in the art for accomplishing the above discussed backgroundreduction is illustrated schematically in FIG. 1.

The accelerator 11 is preferably connected to a pulsing circuit 12 whichmay be of conventional design. A suitable gating circuit 15 may beincluded in the sonde 5 for appropriately actuating the pulsing circuit12 according to whatever operating sequence may be desired. For example,pulsing circuit 12 can be activated via gate 15 to emit a neutron pulseof a specified duration at a predetermined interval. In this manner theearth formations 3 may be irradiated intermittently by the accelerator11 rather than constantly. In operation it would be desirable typicallyto use neutron pulses of about 20 microsecond duration which arerepeated from 500 to 1000 times per second.

Output signals from the level discriminator 14 are coupled via conductor20 to gating circuit 15. Gating circuit 15 may be operated, as will besubsequently described, by a surface timing circuit to maintainsynchronism. Thus the discriminated output signals may be gated in amanner to select portions thereof for transmission to the surface, ifdesired. In this manner selected portions of the detected signals timedrelative to the emission of the neutrons by the accelerator 11 may betransmitted via conductor 21 to a cable driving circuit 16. Cabledriving circuit 16 may be of conventional design as known in the art.Although not depicted in FIG. 1, it will be understood by those skilledin the art that power is supplied from a surface power source (notshown) via the well logging cable 6 to the sonde. Suitable powersupplies (not shown) are provided in the sonde for powering the downholeportion of the equipment.

Referring again to FIG. 1, the detector signals having beendiscriminated against for background by level and possibly time biasesas described are supplied to the logging cable 6 and thence to thesurface of the earth. At its surface end the cable 6 may be connected tothe input of a second gate 40 which is actuated in synchronism with thegating circuit 15 in the downhole sonde 5. The gate 40 may be used, forexample, to permit only groups of counting pulses representing radiationdetected by the crystal 8 while the accelerator 1 1 is quiescent to thesubsequent signal processing circuits.

Gate 40 may be actuated by any of several conventional ways to maintainits synchronism with the operation of the downhole gate circuit 15. Forexample, a turn on signal may be supplied via conductor 18 and thereonfrom pulsing circuit 12. This signal could also be supplied to thesurface by the cable 6 for actuating the gate 40. Alternatively as shownin FIG. 1, a clock or other timing circuit 3% may be connected to boththe gate 40 and to the surface end of the logging cable 6 and therebysupply timing signals simultaneously and synchronously to both the gate40 at the surface and via gating circuit 15 to pulses 12 in the downholesonde thereby maintaining synchronous operation of the pulses andsurface circuits.

In any event, the output signal from the gate 40 comprises a sequence ofcount pulses resulting from gamma rays detected by the downhole crystal8 which are taken preferably during the time interval after theactuation of the accelerator 11 by a sufficient time interval to insurethat most of the pulses due to gamma rays resulting from interactions ofthe generated neutrons with the borehole associated materials have beeneliminated. This may be accomplished in typical formations, for example,by allowing the detector signals through the gate 40 from 200 to 550microseconds after the cessation of the accelerator 11. This pluralityof pulses is supplied to the analyzer 23 which may be a pulse heightanalyzer known in the art having, for example, 32 or more channels, orenergy divisions if desired.

Pulse height analyzer 23 functions to sort and accumulate a runningtotal of the incoming pulses into a plurality of storage locations orchannels based on the height of the incoming pulses. In this manner acumulative record of the number of pulses occurring at each energy maybe derived. The output from the pulse height analyzer 23 channels issupplied first via a plurality of lines 25 of a comparison computerwhere they may be compared (in a manner to be subsequently described)with a weighted plurality of standard gamma ray spectra from a standardspectra source 30. By this comparison a determination of theconstituency of the earth formation surrounding the borehole at thedepth of the sonde may be determined. This data is supplied to arecorder 46 which as indicated by the dotted line 47 has a record mediumdriven as a'function of depth by a mechanical or electronic linkage withthe sheave wheel 7. Alternatively, if desired, the output from the pulseheight analyzer 23 channels may be supplied along plural lines 26 to atape recording apparatus 27 and there stored in digital form on magnetictape as a function of borehole depth. Dotted line 48 indicates that thetape recorder 27 may be driven as a function of depth of the well toolin the borehole in a manner similar to the recorder 46. The pulse heightanalyzer output may then later be taken from a tape produced by the taperecorder 27 and compared with standard spectra in a remote location, forexample, on a digital computer by the method to be subsequentlydescribed for use in the comparison computer 42.

The output from the recorder 46 is shown schematically as a plurality oflogs 50 which are the result of the comparison computer comparing thegamma ray energy spectrum of the formation surrounding the borehole withstandard spectra. The standard spectra are taken in composite weightedgroups for this purpose and the best fit of such composite weightedspectra are obtained in the manner to be described. Thus, for example,the log 50 may record as a function of borehole depth a percentage ofhydrogen, silicon, iron, calcium, chlorine or any other postulatedmaterials in the formation surrounding the borehole.

Referring now to FIG. 2 several standard spectra and a weightedcomposite spectrum made up of these standard spectra are illustratedschematically. These spectra are obtained in the same manner and withthe same tool as the unknown borehole formation spectra and arepre-recorded for use in comparing with the unknown borehole spectrum. Acomposite spectrum made up of a weighted combination of such standardspectra is used for this purpose. FIG. 2, for example, shows individualgamma ray energy spectra which plot number of counts as the ordinate vs.the gamma ray energy as the abcissa for the elements hydrogen, iron,silicon, calcium and chloride.

If a gamma ray spectrometer such as the system of FIG. 1 includes amultichannel pulse height analyzer, such as analyzer 23 having itchannels numbered 1 through n and records a mixed spectra from anunwhere Z, is a random error. To minimize the errors Z,- the principleof least squares is used. That is to say, the square of the random errorZ, is minimized. If the random errors are summed over the channels i=1to n equation 2 results (for the sum of the squares of the random errorsZ,)

i 22 :5? an (1731 i=1 i=1 =1 (2) Minimizing this expression bydifferentiating partially with respect to X and setting the resultantequal to zero equation 3 is obtained.

III II ll nd) 2 l in Equation 3 represents a series of in equationsnumbered from 1 to m and would in the case of three unknown orpostulated nuclei in the mix, for example, be

rz iz 'l" i iz'z niz l iaz n ia 2 m 1 11 11 II n 1' 2 n &2 'l' vz E r?32 M ia 2 m i II ll I1 1'1 1' 2 41 n "him-2 m ia'l'illaz is E ts i (4)II II II II where here the summation over n indicates the summation ofcoefficients a,, over the n channels. By solving these equations for theunknown ratios x x a best fit of the composite spectrum to the unknownspectrum may be obtained. This same type of linear system of] equationsinj unknown results for each assumed mix of j elements. This procedurecould, for example, be performed by the comparison computer 42 of FIG.1.

Unfortunately, electronic equipment such as the multichannel pulseheight analyzer 23 of FIG. I typically has short-term instabilitiesassociated with it as previously discussed. Also temperature variationsat different borehole depths and the varying length of cable as the toolis moved causes further dispersions in the pulse height distributionrepresentative of the detected gamma radiation. These instabilities canresult in drift of the threshold energy of sensitivity and the variationof energy with cahnnel number. Since these errors occur as a function oftime, the electronic characteristic of the instrument at the time thestandard spectra are made may not coincide with theelectroniccharacteristics of the same instrument at the time the unknownborehole formation gamma ray energy spectrum is obtained.

The result of the short-term instabilities is illustrated schematicallyin the graph, FIG. 3. Here greatly exaggerated shifts in the thresholdand gain are illustrated.

The superscript s refers to the standard samples, i.e., energy E, wasthe energy at the center of channel 1 at the time the standard spectrawere made. Also, the energy E, was the energy of the highest numbered ornth channel at the time the standard spectra were made. Generally theresponse of the instrument fell along the line shown from E throughthreshold or baseline value 7; to E,, in a linear manner as the curve 72of FIG. 3 illustrates.

From the time the standard spectra were made to the time the unknownspectrum was made the response of the instrument has shifted due to theinstabilities mentioned above. This effect is illustrated by the line 73of FIG. 3. In the curve 73 the threshold energy is E for channel 1 and Efor channel n. The response varies in a linear manner as shown with adifferent threshold and a different slope or gain characteristic. Suchvariation can cause counts originally appearing in channel 1 when thestandard spectra were made to appear in channel i when the unknownspectra are taken.

This type of threshold and gain drift may be taken into account whileobtaining the least squares fit of the composite weighted spectrum tothe unknown gamma ray spectrum in the manner to be subsequently de-,scribed. This result is obtained by using an iterative technique in themanner of the invention where in the threshold channel (baseline) andgain of the standard spectra individually and in the composite arevaried during the process of obtaining the last squares fit of theunknown to the standard spectra. This allows a more optimum fit with theunknown spectrum to be obtained than would otherwise be possible.

The iterative technique for obtaining an optimum least squares fit ofthe unknown spectrum to a weighted mixture of the standard spectra maybest be described by reference to FIGS. 4 and 5. Referring initially toFIG. 4 the overall logic flow for the least squares fitting technique isillustrated schematically in the form of the logic flow chart for adigital computer program.

A program to perform the technique illustrated in the logic flow may beoperated on a computer such as the comparison computer 42 of FIG. 1.Alternatively if the unknown spectra have been stored on tapes such asproduced by the tape recorder 27 of FIG. 1, these may be processed by adifferent, possibly remotely located, computer at a later time.

In any event when the computer program of FIG. 4 is entered or started,the first step is to input the standard spectra library to the computeras indicated at block 81, FIG. 4) from an input device such as thestandard spectra source 30 of FIG. 1. Such a source could comprise, forexample, a magnetic tape having the previously recorded standard spectrathereon, punched computer cards, a computer disc file record or anyother convenient source of data storage. These standard spectra couldcomprise, for example, digital recordings of the number of counts, thechannel number, the gain (or slope of the instrument response as in FIG.3) and the baseline (or threshold, as 1; of FIG. 3) of the instrument.When the standard spectrum library is input, the next step isillustrated at block 82 as inputting the unknown spectrum to be fittedto a weighted combination of standard spectra. The program then proceedsto block 83 where two counters (NIT and NSRCH) are both initialized bysetting them equal to zero. Counter NIT counts the number of iterationsto be performed while adjusting the gain and baseline of the compositeweighted standard spectrum for a fit to an unknown spectrum. The counterNSRCH counts the number of searches through the standard spectra invarying their individual gains and baselines to most nearly fit theunknown. This is in keeping with the overall technique of the inventionwhich is to vary these quantities to reach an optimum fit.

The program then proceeds to block 84 at which an initial estimate ofthe gain and baseline of the weighted mixture of standard spectra to beused in the fit is made. This may, for example, be based on the gain andbaseline of the standard spectra as input from the library or may resultfrom modified library spectra which will be subsequently described whichhave been obtained from previous fittings of unknown spectra.

The next step taken by the program is indicated at block 85. This is toperform a weighted least squares fit of the standard spectra taken in aweighted combination to the unknown specteum being examined. The termweighted least squares fit as used in block 85 means that the entirespectrum (i.e., the standard spectrum made up of a composite of standardindividual spectra) is weighted statistically in each channel by afactor of l/ n where n is the number of counts in that particularchannel or energy range of the composite spectrum. This statisticalweighting is done to enhance the statistical value of the fit as it maybe shown that the standard deviation (a measure of the reliability) of achannel is proportional to the square root of the number of countsappearing in that channel. Weighting in this manner tends to give aproper accordance to channels having more counts than to other channelscontaining less counts. The term weighted mixture of standard spectra asused herein corresponds to the unknown ratios x, mentioned previously.These are the ratios of the individual elements of the standard spectrato the postulated individual components in the unknown spectrum beingexamined which are determined by the method of least squares.

By the term perform least squares fit as used in describing the programlogic flow of FIGS. 4 and 5, it is meant to solve the system of linearequations (such as those illustrated by Equations 4) for the unknownratios x, and thereby obtain an estimate of the proportion of each ofthe postulated elements in the unknown spectrum. This solution may beobtained by any of the known techniques for solving linear systems asdesired.

When the first least squares fit is performed at block 85, the next stepin the program is to increase the iterations counter NIT by l and then,as indicated at block 87, to re-estimate the gain and baseline of thecomposite or source spectrum in a manner which will tend to possiblyenhance the fit of the source spectrum to the unknown spectrum. At block88 a test is performed to see if the gain and baselines so estimatedagree with the library values of the gain and baselines of the sourcespectrum. Taking the case where they do not agree, which is the mostlikely to occur initially, a test is performed at block 89 to determineif four iterations have been performed re-estimating the gain andbaseline. If not, the program proceeds to block 90 where the gain andbaseline of the source spectrum are corrected and the program thenproceeds back to block 85 to perform another weighted least squares fit.This process will be continued until the test at block 89 is exhausted(i.e., until four iterations have been performed with corrected gain andbaselines of the composite or source spectrum). When the test at block89 passes (i.e., when four iterations have been performed) the programthen proceeds to block 91 to determine if at least three searches (i.e.,individual spectra gain and baseline variances) of the standard spectrahave been performed. Block 91 is also entered from the test at block 88if the gain and baseline setting, when re-estimated, agrees with thecurrent library value.

If three searches through the standard spectrum have not been performed,then at block 94 the subprogram described in more detail in FIG. iscalled to vary the gain and baseline of each of the library standardspectra individually to possibly enhance the fit of the combinationspectrum made up of these library spectra. This function is performed asmany as three times, and each time it is performed the counter NSRCH isincreased by 1 as indicated by block 95 and the program loops back toresume least squares fitting of the reestimated source weighted spectrumat block 85. If at least three separate passes through the subprogramcalled at block 94 are performed, then it is assumed that the bestpossible fit of the weighted combination of standard spectra has beenmade to the unknown spectrum and as indicated at block 92 the computedweights of the postulated elements of the last least squares fit of theunknown spectrum to the standard source spectrum is output along with thresiduals or differences between the two spectra (the composite and theunknown) in each channel or energy range. This output may be in theform, for example, of a well log of the computed weights or percentagesof the elements of the postulated combination of standard spectracontained in the unknown spectrum.

Finally, if all of the unknown spectra are fit, as indicated by the testat block 93, the program exits, finished. Otherwise, it loops back topick up the next unknown spectrum using either the modified libraryspectra as generated by the subprogram to be described in respect toFIG. 5 or to resume curve fitting using the standard input spectrumlibrary. These alternative steps are indicated by the dotted lines ofFIG. 4.

Referring now to FIG. 5, the details of the subprogram called in block94 of FIG. 4 are shown. This illustrates how the gain and baseline ofeach individual library standard spectrum comprising the postulatedcomposite spectrum, being fit to an unknown spectrum by the method ofleast squares, are individually varied to improve the overall fit.

When the subprogram is entered, an initial standard spectrum is selectedat block 100. This spectrum is used to establish the temporary librarystandard whose gain and baseline are to be varied to see if a possiblebetter fit may be obtained. For example, the hydrogen spectrum of FIG. 2may be picked first for this purpose. Alternately, any of the otherstandard spectra could be selected, of course. The program proceeds atblock 101 to change the gain (i.e., the slope of the count vs. energycurve, such as curve 72 or 73 of FIG. 3) by .+1 percent. Using thischanged gain setting, then the program (block 102) performs a leastsquares fit of the new composite spectrum with the unknown spectrum.

With the new least squares fit (using the varied gain) the programproceeds at block 103 to determine if the fitted improved over thatpreviously obtained. This test is done by the comparing of the presentvalue of the ratio of X, (where X identified in equation 5) divided bythe quantity (n m) to the previous value has decreased 111 x =Z(yiyi /y.

In the above expression the y,- represents the counts of the standardspectra while the y,-' represents the counts of the unknown spectrum inthe same channel. Here also n equals the number of channels used in thespectrum and m equals the number of standard spectra taken in thecomposite mixture. If changing the gain by +1 percent initially didimprove the fit, then the program proceeds to block 104 where the gainis again increased by 1 percent and, as indicated at block 105, anotherleast squares fit using this new gain changed individual spectrum takenin composition with the remaining standard spectra is made. Using thisnew least squares fit a test is performed at block 106 to see if againthe increase of gain enhanced the fit. This is the same type of test asperformed at block 103. In this manner the program loops back to block104 as long as a gain increase enhances the fit. If this no longerenhances the fit, then the program proceeds to block 110.

If the original gain change of +1 percent did not enhance the fit, thenthe gain is decreased by 1 percent as indicated at block 107 and a leastsquares fit is performed at block 108 with the decreased gain setting.At block 109 the program determines if this improves the fit of thecomposite spectrum. As long as this process (i.e., decreasing the gain)does improve the fit, the program loops back to block 107 from block 109to continue reducing the gain until an optimum fit is obtained. Finally,when the optimum fit is obtained by reducing the gain, the program goesto block 110 where the gain settings are established in the optimummanner for this individual spectrum in the overall composite mix ofstandard spectra.

When the program exits from block 110, the best gain setting for anindividual spectrum component is established. The program then proceedsat block 111 to change the baseline setting b, by one channel. With thisdone and using the newly established gain, the program proceeds at block112 to determine a new least squares fit of the composite weightedmixture with the unknown spectrum. At block 113 a test is performed inthe same manner described with respect to block 103 to see if the fit isenhanced by this process. If the fit is enhanced, the program proceeds(block 114) to change the baseline by +1 channel again and to perform anew least squares fit of the composite source spectrum (block 115) usingthis fitting of the baseline. If, as indicated by the test at block 116,this process again improves the fit of the composite spectrum to theunknown, the program loops back to block 114 and continues the baselineor threshold change until this procedure no longer improves the fit. Atthat time the program goes to block 117 with the baseline settingestablished.

Returning to block 113, if changing the baseline by +1 channel does notimprove the fit as indicated by this test, the program then proceeds toblock 118 and reduces the baseline setting by one channel. A new leastsquares fit of the composite spectrum is performed with back to block118 and continues reducing the baseline setting by one channel until nofurther improvement occurs.

At that time the program exits from block 117 to to block 121 placingthe gain and baseline modified standard spectrum in a modified libraryof spectra. This modified spectra library may be used in fitting tofurther unknown spectra if desired (this step is indicated by the dottedline alternatives of H6. 4). The program then proceeds to block 122where it determines if there are any more standard spectra left to vary.If not, the program exits and is finished with the variation of allindividual standard spectra gain and baseline.

Alternately, it will be understood, that if desired that the gain andbaseline of the spectra can be varied by less than :1 percent or :1channel to achieve an optimized fit. For example, it is possible thatafter NSRCH=3 or NIT=2 that a finer mesh such as i0.l percent or $0.1channel could be used if desired. Of course, still finer gradiationscould be used if further accuracy were called for.

In this manner, it is seen that the technique of the present inventionincludes variation in gain and baseline or threshold setting of thecomposite weighted mixture of standard spectra to best fit the unknownspectrum. The variation is accomplished both by varying the gain andbaseline of the composite spectra itself and then by separately varyingthe gain and baseline of the individual components comprising thepostulated composite of standard spectra. It should be noted also thatin this technique in addition to the unknown weights or percentages Xwhich are determined by the method of least squares fitting, that theoverall statistics are enhanced by weighting the counts in each channelby their statistical value.

The above description may make alternative techniques apparent to thoseskilled in the art. It is the aim in the appended claims to cover allsuch changes and modifications as may be made apparent to those skilledin the art in order that the true spirit and scope of the invention willbe protected.

What is claimed is:

l. A method for determining the unknown composition of earth formationssurrounding a well borehole comprising the steps of:

obtaining standard gamma ray energy spectra of materials postulated tobe in formations surrounding a well bore;

obtaining gamma ray energy spectra of the unknown materials surroundinga well borehole;

comparing each unknown gamma ray spectrum with a composite standardspectrum comprising a weighted mixture of said standard spectra at aselected number of energy levels at least as numerous as the individualpostulated components of said weighted mixture; and

varying an energy to intensity characteristic of the composite spectrumand repeating the above comparing step in an iterative manner to achievean optimized comparison of said composite standard spectrum and saidunknown spectrum.

2. The method of claim 1 wherein the standard gamma ray energy spectraand the unknown gamma ray energy spectra are obtained in the same mannerand the standard spectra are obtained prior to obtaining the unknownspectra.

3. The method of claim 1 and further including the step of obtainingstandard gamma ray energy spectra of materials not postulated to beformation constituents but postulated to be borehole constituents.

4. The method of claim 3 wherein the standard spectra of both postulatedformation constituents and postulated borehole constituents are used inthe comparing and varying steps.

5. The method of claim 1 wherein the gamma ray energy spectra areobtained by use of a pulse neutron source to excite the formations aboutthe borehole.

6. A method for determining the composition of earth formationssurrounding a well borehole comprising the steps of:

obtaining standard gamma ray energy spectra of materials postulated tobe in formations surrounding a well bore;

obtaining gamma ray energy spectra of the unknown materials surroundinga well borehole; I

comparing each unknown spectrum with a composite standard spectrumcomprising a weighted mixture of said standard spectra and determiningthe ratio of each of the postulated materials in the composite standardspectrum to the unknown spectrum at a plurality of energy levels in thespectra at least as numerous as the number of postulated components inthe composite spectrum;

varying the gain and baseline of the composite spectrum and repeatingthe comparing step in an iterative manner to achieve an optimizedcomparison of said composite standard spectrum and said unknownspectrum; and

recording said ratios or a quantity related thereto as being indicativeof the amount of each of said postulated materials.

7. The method of claim 6 wherein the steps of obtaining the unknowngamma ray spectra, comparing the standard spectra, varying the gain andbaseline of the composite spectrum and recording said ratios arerepeated at various borehole depths and said ratios are recorded as afunction of borehole depth.

8. The method of claim 6 and further including the step of varying thegain and baseline of selected individual standard spectra comprisingsaid composite standard spectra and repeating the comparing and varyingsteps using new composite spectra made up of the individually variedstandard spectra to obtain a still further optimized comparison of saidstandard spectra and said unknown spectra.

9. The method of claim 8 wherein the steps of obtaining the unknownspectra, comparing the standard spectra, varying the gain and baselineof the composite standard spectrum, varying the gain and baseline of theindividual standard spectra comprising said composite standard spectrumand recording said ratios are repeated at various borehole depths andsaid ratios are recorded as a function of borehole depth.

10. A method for determining the unknown composition of earth formationssurrounding a well borehole comprising the steps of:

obtaining standard gamma ray energy spectra of materials postulated tobe in and about a well borehole;

obtaining gamma ray energy spectra of the unknown materials in and abouta well borehole; comparing each unknown gamma ray spectrum with acomposite standard spectrum comprising a weighted mixture of saidstandard spectra at a selected number of energy levels at least asnumerous as the individual postulated components of said weightedmixture;

varying an energy to intensity characteristic of the composite standardspectrum and repeating the above comparing step in an iterative mannerto achieve an optimized comparison of said composite and said unknownspectra;

varying an energy to intensity characteristic of selected individualcomponents of said composite standard spectrum and repeating the abovecomparing and varying steps to achieve an even further optimizedcomparison of said composite and said standard spectra.

11. The method of claim 10 wherein the standard gamma ray energy spectraare obtained prior to said unknown spectra and said standard spectra andsaid unknown spectra are obtained in the same manner.

12. The method of claim 10 wherein the gamma ray energy spectra areobtained from neutron activated materials, said materials beingactivated by use of a pulsed neutron source.

13. The method of claim 10 wherein the step of comparing the unknowngamma ray spectrum with a composite standard spectrum comprising aweighted mixture of individual standard spectra components is performedby determining the ratio of each of the postulated materials in theunknown spectrum to the same material in said composite standardspectrum.

14. The method of claim 13 wherein said ratios are determined by usingthe method of minimizing the squares of the random errors occuring whensaid spectra are obtained.

15. The method of claim 14 wherein said ratios .1: are

determined by solving a linear system of k equations of the form where ais the count appearing in energy level i from standard compositespectrum component j, b, is the count appearing in energy level i of theunknown spectrum and wherein the index k 1,2 m is at least as numerousas the m standards comprising the composite standard spectrum.

16. The method of claim 10 wherein the energy to intensitycharacteristic of the composite spectrum which is varied to obtain anoptimized comparison in the gain of composite spectrum.

17. The method of claim 16 wherein a second energy to intensitycharacteristic of the composite spectrum, the baseline, is also variedto obtain an optimized comparison.

18. The method of claim 10 wherein the energy to intensitycharacteristic of said selected individual components of said compositespectrum which is varied to obtain an optimized comparison is thebaseline of said component.

19. The method of claim 18 wherein a second energy to intensitycharacteristic of said selected individual components of said compositespectrum, the gain, is also varied to obtain an optimized comparison.

20. The method of claim 10 and further including the step of recordingsaid unknown spectra so obtained as a function of borehole depth.

1. A method for determining the unknown composition of earth formationssurrounding a well borehole comprising the steps of: obtaining standardgamma ray energy spectra of materials postulated to be in formationssurrounding a well bore; obtaining gamma ray energy spectra of theunknown materials surrounding a well borehole; comparing each unknowngamma ray spectrum with a composite standard spectrum comprising aweighted mixture of said standard spectra at a selected number of energylevels at least as numerous as the individual postulated components ofsaid weighted mixture; and varying an energy to intensity characteristicof the composite spectrum and repeating the above comparing step in aniterative manner to achieve an optimized comparison of said compositestandard spectrum and said unknown spectrum.
 2. The method of claim 1wherein the standard gamma ray energy spectra and the unknown gamma rayenergy spectra are obtained in the same manner and the standard spectraare obtained prior to obtaining the unknown spectra.
 3. The method ofclaim 1 and further including the step of obtaining standard gamma rayenergy spectra of materials not postulated to be formation constituentsbut postulated to be borehole constituents.
 4. The method of claim 3wherein the standard spectra of both postulated formation constituentsand postulated borehole constituents are used in the comparing andvarying steps.
 5. The method of claim 1 wherein the gamma ray energyspectra are obtained by use of a pulse neutron source to excite theformations about the borehole.
 6. A method for determining thecomposition of earth formations surrounding a well borehole comprisingthe steps of: obtaining standard gamma ray energy spectra of materialspostulated to be in formations surrounding a well bore; obtaining gammaray energy spectra of the unknown materials surrounding a well borehole;comparing each unknown spectrum with a composite standard spectrumcomprising a weighted mixture of said standard spectra and determiningthe ratio of each of the postulated materials in the composite standardspectrum to the unknown spectrum at a plurality of energy levels in thespectra at least as numerous as the number of postulated components inthe composite spectrum; varying the gain and baseline of the compositespectrum and repeating the comparing step in an iterative manner toachieve an optimized comparison of said composite standard spectrum andsaid unknown spectrum; and recording said ratios or a quantity relatedthereto as being indicative of the amount of each of said postulatedmaterials.
 7. The method of claim 6 wherein the steps of obtaining theunknown gamma ray spectra, comparing the standard spectra, varying thegain and baseline of the composite spectrum and recording said ratiosare repeated at various borehole depths and said ratios are recorded asa function of borehole depth.
 8. The method of claim 6 and furtherincluding the step of varying the gain and baseline of selectedindividual standard spectra comprising said composite standard spectraand repeating the comparing and varying steps using new compositespectra made up of the individually varied standard spectra to obtain astill further optimized comparison of said standard spectra and saidunknown spectra.
 9. The method of claim 8 wherein the steps of obtainingthe unknown spectra, comparing the standard spectra, varying the gainand baseline of the composite standard spectrum, varying the gain andbaseline of the individual standard spectra comprising said compositestandard spectrum and recording said ratios are repeated at variousborehole depths and said ratios are recorded as a function of boreholedepth.
 10. A method for determining the unknown composition of earthformations surrounding a well borehole comprising the steps of:obtaining standard gamma ray energy spectra of materials postulated tobe in and about a well borehole; obtaining gamma ray energy spectra ofthe unknown materials in and about a well borehole; comparing eachunknown gamma ray spectrum with a composite standard spectrum comprisinga weighted mixture of said standard spectra at a selected number ofenergy levels at least as numerous as the individual postulatedcomponents of said weighted mixture; varying an energy to intensitycharacteristic of the composite standard spectrum and repeating theabove comparing step in an iterative manner to achieve an optimizedcomparison of said composite and said unknown spectra; varying an energyto intensity characteristic of selected individual components of saidcomposite standard spectrum and repeating the above comparing andvarying steps to achieve an even further optimized comparison of saidcomposite and said standard spectra.
 11. The method of claim 10 whereinthe standard gamma ray energy spectra are obtained prior to said unknownspectra and said standard spectra and said unknown spectra are obtainedin the same manner.
 12. The method of claim 10 wherein the gamma rayenergy spectra are obtained from neutron activated materials, saidmaterials being activated by use of a pulsed neutron source.
 13. Themethod of claim 10 wherein the step of comparing the unknown gamma rayspectrum with a composite standard spectrum comprising a weightedmixture of individual standard spectra components is performed bydetermining the ratio of each of the postulated materials in the unknownspectrum to the same material in said composite standard spectrum. 14.The method of claim 13 wherein said ratios are determined by using themethod of minimizing the squares of the random errors occuring when saidspectra are obtained.
 15. The method of claim 14 wherein said ratios xjare determined by solving a linear system of k equations of the formwhere aij is the count appearing in energy level i from standardcomposite spectrum component j, bi is the count appearing in energylevel i of the unknown spectrum and wherein the index k 1,2 - - - m isat least as numerous as the m standards comprising the compositestandard spectrum.
 16. The method of claim 10 wherein the energy tointensity characteristic of the composite spectrum which is varied toobtain an optimized comparison in the gain of composite spectrum. 17.The method of claim 16 wherein a second energy to intensitycharacteristic of the composite spectrum, the baseline, is also variedto obtain an optimized comparison.
 18. The method of claim 10 whereinthe energy to intensity characteristic of said selected individualcomponents of said composite spectrum which is varied to obtain anoptimized comparison is the baseline of said component.
 19. The methodof claim 18 wherein a second energy to intensity characteristic of saidselected individual components of said composite spectrum, the gain, isalso varied to obtain an optimized comparison.
 20. The method of claim10 and further including the step of recording said unknown spectra soobtained as a fuNction of borehole depth.